<a href="/"><div class="topBack"><img src="/images/back_jiantou.png" style="width:40px;height:40px;"></div></a>
<div class="topContent">余额充值</div>
<div class="topRight">&nbsp;</div>
<div class="clear"></div>

<div id="wrapperTopup" class="wrapperComman" style="top:40px;bottom:0px;">
<div style="width:100%;">

<div style="width:20%;height:80px;float:left;text-align:center;"><img src="/images/topupyuan.png" style="width:70px;height:70px;"></div>
<div style="width:50%;height:80px;float:left;padding:15px 0px;">
	<p style="color:grey;font-size:0.9em;">当前余额</p>
	<p style="font-size:0.8em;color:grey;"><span id="totalCredit" style="color:red;font-size:1.4em;font-weight:bolder;"><?php if(!empty($this->res_info->User)){echo $this->res_info->User->balance;}else{echo 0;}?></span>元</p>
</div>
<div style="width:30%;height:80px;float:left;padding-top:15px;"><span style="padding-top:5px;padding-left:5px;font-size:0.95em;"><a href="/personal/topupdetail" style="color:#2EA821;">余额明细</a></span></div>
<div class="clear"></div>

<div class="beijin"></div>
<div style="padding:5px 10px;font-size:0.9em;">请选择充值金额</div>
<?php
	foreach($this->res as $r){
		echo '
			<div class="floatleft" tag="'.$r->id.'" onclick="javascript:buyTopup(this);return false;" style="font-size:0.9em;">&nbsp;<span style="position:relative;top:5px;">'.$r->amount;
			if($r->present>0){
				echo '<span style="color:red;">（充'.$r->amount.'送'.$r->present.'）</span>';
			}
			echo '</span></div>
			<div class="floatright gou_position gouBuy" tag="'.$r->id.'" id="gou'.$r->id.'" onclick="javascript:buyTopup(this);return false;"><img src="/images/meigou.png" class="gougou gg"></div>
			<div class="clear"></div>
		';
	}
?>

<div class="beijin"></div>
<div style="padding:5px 10px;font-size:0.9em;">请选择支付方式</div>
<div class="floatleft" tag="weixin" onclick="javascript:zhifuHandler(this);return false;" style=""><img class="zhifu_img" src="/images/weixin.png">&nbsp;<span style="position:relative;top:5px;">微信支付</span></div>
<div class="floatright gou_position" tag="weixin" onclick="javascript:zhifuHandler(this);return false;" id="weixin_zhifu"><img src="/images/meigou.png" class="gougou"></div>
<div class="clear"></div>

<!--<div class="floatleft" tag="alipay" onclick="javascript:zhifuHandler(this);return false;">
	<img class="zhifu_img" src="/images/zhifubao.png">&nbsp;
	<span style="position:relative;top:5px;">支付宝支付</span>
</div>
<div class="floatright gou_position" tag="alipay" onclick="javascript:zhifuHandler(this);return false;" id="zhifubao_zhifu">
	<img src="/images/meigou.png"  class="gougou">
</div>
<div class="clear"></div>-->

<div style="padding:20px;font-size:0.85em;"><img id="agreeGou" src="/images/yigou.png" style="width:23px;height:23px;" onclick="javascript:agreeProtocol();return false;">&nbsp;&nbsp;同意《鲜店余额协议》</div>
<input type="hidden" value="0" id="buyTopup">
<input type="hidden" value="0" id="payMethod">
<input type="hidden" value="1" id="agreeProtocol">
<input type="button" id="topupPay" class="cp_btn" value="确认支付" style="border:0px;margin-bottom:20px;" onclick="javascript:confirmTopup();return false;">
<div style="height:50px;width:100%;">&nbsp;</div>
</div>
</div>

<script type="text/javascript">
	var myscroll='';
	$(document).ready(function() {
		$('.gg')[0].src='/images/yigou.png';
		$('#buyTopup').val(<?php echo $this->res[0]->id;?>);
		$('#payMethod').val('weixin');
		$('#weixin_zhifu').html('<img src="/images/yigou.png"  class="gougou">');
        function loaded(){
           setTimeout(function(){
                    myscroll=new iScroll("wrapperTopup");
             },100 );
        }
		loaded();
	});
	

</script>